package jdbc;

import java.sql.Connection;
import java.sql.Statement;
import java.util.Scanner;

public class Test {
    public static void main(String[] args) {
        System.out.println("请输入");
        Scanner scan=new Scanner(System.in);
        try (
            Connection connection = DBUtil.getConnection();
        ){
            Statement statement=connection.createStatement();
            String sql = "DELETE FROM userinfo\n" +
                    "WHERE username=scan";
            int num = statement.executeUpdate(sql);
            if (num>0){
                System.out.println("删除成功！");
            }else {
                System.out.println("删除失败");
            }
        }catch (Exception e){
            e.printStackTrace();
        }
    }
}
